/*
 * @Author: your name
 * @Date: 2021-12-23 19:49:18
 * @LastEditTime: 2021-12-24 17:54:49
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day12 ts 路由 月考\my-app\src\store\indexaction.tsx
 */
import axios from "axios"
import "../mock/mock"
import {Dispatch} from "redux"
import {newState} from "./store.d"

export let getList=(obj:newState)=>{
    return async(dispatch:Dispatch)=>{
        let res=await axios.post("/api/list",obj)
        dispatch({
            type:"GETLIST",
            payload:res.data.list
        })
    }
}

export let changestore=(info:string,index:number)=>{
    return {
        type:"CHANGESTORE",
        info,
        index
    }
}